package com.healthysys.backend.controller;

import com.healthysys.backend.service.UserPoService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import pojo.dto.UserPODTO;
import pojo.dto.UserRoleAuthorityVOPageDTO;
import pojo.result.PageResult;
import pojo.result.Result;
import pojo.vo.UserRoleAuthorityVO;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserPoController {

    @Resource
    private UserPoService userPoService;

    /**
     * 添加用户
     * @param userPODTO
     * @return
     */
    @PostMapping
    public Result<Void> addUserPO(@RequestBody UserPODTO userPODTO){
        userPoService.addUserPO(userPODTO);
        return Result.success("添加用户成功");
    }

    @GetMapping
    public PageResult<List<UserRoleAuthorityVO>> getUserRoleAuthorityVOPage(@RequestBody UserRoleAuthorityVOPageDTO userRoleAuthorityVOPageDTO){
        PageResult<List<UserRoleAuthorityVO>> result=userPoService.getUserRoleAuthorityVO(userRoleAuthorityVOPageDTO);
        return result;
    }

}
